/*  1:   */ package com.atomikos.datasource.xa;
/*  2:   */ 
/*  3:   */ import javax.transaction.xa.Xid;
/*  4:   */ 
/*  5:   */ public abstract class AbstractXidFactory
/*  6:   */   implements XidFactory
/*  7:   */ {
/*  8:   */   private static final int MAX_LENGTH_OF_COUNTER = 8;
/*  9:46 */   static long counter = 0L;
/* 10:   */   
/* 11:   */   protected static void incCounter()
/* 12:   */   {
/* 13:53 */     counter += 1L;
/* 14:   */   }
/* 15:   */   
/* 16:   */   protected static long getCounter()
/* 17:   */   {
/* 18:58 */     return counter;
/* 19:   */   }
/* 20:   */   
/* 21:   */   public Xid createXid(String tid, String resourcename)
/* 22:   */   {
/* 23:74 */     if (resourcename.getBytes().length + 8 > 64) {
/* 24:76 */       throw new IllegalArgumentException("Value too long: " + resourcename);
/* 25:   */     }
/* 26:83 */     incCounter();
/* 27:84 */     return new XID(tid, resourcename + getCounter());
/* 28:   */   }
/* 29:   */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions-jta\3.7.0\transactions-jta-3.7.0.jar
 * Qualified Name:     com.atomikos.datasource.xa.AbstractXidFactory
 * JD-Core Version:    0.7.0.1
 */